package com.miguo.bean;

import com.miguo.framework.request.JsonData;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;


public class GoodsBean implements Serializable {
    private static final Long serialVersionUID = 1L;

    private Long id;
    private Long item_id;
    private String title;
    private String pic_url;
    private String price;
    private String coupon_price;
    private String phone_price;
    private Long volume;
    private Integer item_type;
    private String click_url;
    private Long begin_time;
    private Long end_time;
    private Integer jump_type;
    private Long classify_id;//类型ID
    private String share_url;//分享地址
    private Object tag;//额外字段，Tag标示，用于保存数据

    public GoodsBean() {
    }

    public GoodsBean(Object tag) {
        this.tag = tag;
    }

    public GoodsBean(JsonData goods) {
        id = goods.optLong("id");
        item_id = goods.optLong("item_id");
        title = goods.optString("title");
        pic_url = goods.optString("pic_url");
        click_url = goods.optString("click_url");
        volume = goods.optLong("volume");
        price = goods.optString("price");
        coupon_price = goods.optString("coupon_price");
        phone_price = goods.optString("phone_price");
        item_type = goods.optInt("item_type");
        begin_time = goods.optLong("begin_time");
        end_time = goods.optLong("end_time");
        jump_type = goods.optInt("jump_type");
        classify_id = goods.optLong("classify_id");
        share_url = goods.optString("share_url");
    }

    public GoodsBean(Long id) {
        this.id = id;
    }

    public GoodsBean(Long id, Long item_id, String title, String pic_url, String price, String coupon_price, String phone_price, Long volume, Integer item_type, String click_url, Long begin_time, Long end_time, Integer jump_type,Long classify_id,String share_url) {
        this.id = id;
        this.item_id = item_id;
        this.title = title;
        this.pic_url = pic_url;
        this.price = price;
        this.coupon_price = coupon_price;
        this.phone_price = phone_price;
        this.volume = volume;
        this.item_type = item_type;
        this.click_url = click_url;
        this.begin_time = begin_time;
        this.end_time = end_time;
        this.jump_type = jump_type;
        this.classify_id = classify_id;
        this.share_url = share_url;
    }

    public GoodsBean(JSONObject json) throws JSONException {
        id = json.getLong("id");
        item_id = json.getLong("item_id");
        title = json.getString("title");
        pic_url = json.getString("pic_url");
        click_url = json.getString("click_url");
        volume = json.getLong("volume");
        price = json.getString("price");
        coupon_price = json.getString("coupon_price");
        phone_price = json.getString("phone_price");
        item_type = json.getInt("item_type");
        begin_time = json.getLong("begin_time");
        end_time = json.getLong("end_time");
        jump_type = json.getInt("jump_type");
        classify_id = json.optLong("classify_id");
        share_url = json.optString("share_url");
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getItem_id() {
        return item_id;
    }

    public void setItem_id(Long item_id) {
        this.item_id = item_id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getPic_url() {
        return pic_url;
    }

    public void setPic_url(String pic_url) {
        this.pic_url = pic_url;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getCoupon_price() {
        return coupon_price;
    }

    public void setCoupon_price(String coupon_price) {
        this.coupon_price = coupon_price;
    }

    public String getPhone_price() {
        return phone_price;
    }

    public void setPhone_price(String phone_price) {
        this.phone_price = phone_price;
    }

    public Long getVolume() {
        return volume;
    }

    public void setVolume(Long volume) {
        this.volume = volume;
    }

    public Integer getItem_type() {
        return item_type;
    }

    public void setItem_type(Integer item_type) {
        this.item_type = item_type;
    }

    public String getClick_url() {
        return click_url;
    }

    public void setClick_url(String click_url) {
        this.click_url = click_url;
    }

    public Long getBegin_time() {
        return begin_time;
    }

    public void setBegin_time(Long begin_time) {
        this.begin_time = begin_time;
    }

    public Long getEnd_time() {
        return end_time;
    }

    public void setEnd_time(Long end_time) {
        this.end_time = end_time;
    }

    public Integer getJump_type() {
        return jump_type;
    }

    public void setJump_type(Integer jump_type) {
        this.jump_type = jump_type;
    }

    public Long getClassify_id() {
        return classify_id;
    }

    public void setClassify_id(Long classify_id) {
        this.classify_id = classify_id;
    }

    public String getShare_url() {
        return share_url;
    }

    public void setShare_url(String share_url) {
        this.share_url = share_url;
    }

    public Object getTag() {
        return tag;
    }

    public void setTag(Object tag) {
        this.tag = tag;
    }
}
